package com.dzl.constant;

import com.dzl.config.ApplicationConfiguration;

/**
 * 蓝色兄弟 常量
 * @author WangJian
 * @date 2021/7/13 0013
 */
public class ApiBlueBrothersConstant {

    //直充下单接口
    public static final String DIRECT_URL = getUrl() + "/order";
    //订单查询接口
    public static final String ORDER_URL = getUrl() + "/query";
    //余额查询接口
    public static final String BALANCE_URL = getUrl() + "/info";
    //产品查询接口
    public static final String PRODUCT_URL = getUrl() + "/product";
    //秘钥
    public static final String KEY = getKey();
    //回调地址
    public static final String NOTIFY_URL = ApplicationConfiguration.getDomain() + "/applet/blueBrothers/notify";
    //商户号
    public static final String MERCHANT_ID = getMerchantId();

    /**
     * 获取API地址 正式服or测试服
     * @date 2021/7/14 0014 11:44
     * @author wangjian
     * @param
     * @return java.lang.String
     */
    public static String getUrl() {
        String isProduct = ApplicationConfiguration.getInstance().getIsProduct();
        if (isProduct == null || "0".equals(isProduct)) {
            System.out.println("getUrl: " + isProduct);
            return "http://test.openapi.1688sup.cn/recharge";
        } else {
            return "http://openapi.1688sup.com/recharge";
        }
    }

    /**
     * 获取KEY 正式服or测试服
     * @date 2021/7/14 0014 11:44
     * @author wangjian
     * @param
     * @return java.lang.String
     */
    public static String getKey() {
        String isProduct = ApplicationConfiguration.getInstance().getIsProduct();
        if (isProduct == null || "0".equals(isProduct)) {
            System.out.println("getKey: " + isProduct);
            return "8db16e8cc8363ed4eb4c14f9520bcc32";
        } else {
            return "e31b66e7c677614edad121c674dde933";
        }
    }

    /**
     * 商户号
     * @date 2021/7/30 0030 9:55
     * @author wangjian
     * @param
     * @return java.lang.Integer
     */
    public static String getMerchantId() {
        String isProduct = ApplicationConfiguration.getInstance().getIsProduct();
        if (isProduct == null || "0".equals(isProduct)) {
            System.out.println("getMerchantId: " + isProduct);
            return "23329";
        } else {
            return "23914";
        }
    }
}
